package cn.fay.chapter18;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
/**
 * BIG_ENDIAN是java默认的排序方式，也就是网络序
 * LITTLE_ENDIAN是主机序
 * @author emellend
 *
 */
public class Endians {

	public static void main(String[] args) {
		ByteBuffer bb=ByteBuffer.allocate(12);
		bb.order(ByteOrder.BIG_ENDIAN);
		bb.asCharBuffer().put("abcdef");
		System.out.println(Arrays.toString(bb.array()));
		bb.rewind();
		bb.order(ByteOrder.LITTLE_ENDIAN);
		bb.asCharBuffer().put("abcdef");
		System.out.println(Arrays.toString(bb.array()));
	}

}
